package woaini.wind.bot.code.impl.weChatFerry;

import woaini.wind.bot.code.impl.weChatFerry.adapter.WeChatFerryBotHttpAdapter;
import woaini.wind.bot.code.impl.weChatFerry.config.WeChatFerryBotConfig;
import woaini.wind.bot.code.impl.weChatFerry.internal.WeChatFerryBotInternal;
import woaini.wind.bot.core.adapter.Adapter;
import woaini.wind.bot.core.adapter.hook.CommonHttpHook;
import woaini.wind.bot.core.bot.Bot;
import woaini.wind.bot.core.internal.Internal;

/**
 * 微信机器人bot
 * @see woaini.wind.bot.code.impl.weChatFerry.WeChatFerryBot
 * @author yefeng {@date 2024-12-27 14:46:29}
 */
public class WeChatFerryBot extends Bot<WeChatFerryBotConfig> {

  public static final String NAME = "WeChatFerryBot";

  private Adapter sendAdapter;

  private Adapter receiveAdapter;

  public WeChatFerryBot(WeChatFerryBotConfig config) {
    super(config);
    this.init();
  }

  public void init(){
    WeChatFerryBotHttpAdapter weChatFerryBotHttpAdapter = new WeChatFerryBotHttpAdapter(this);
    //仅支持http
    this.sendAdapter = weChatFerryBotHttpAdapter;
    this.receiveAdapter = weChatFerryBotHttpAdapter;
    CommonHttpHook.addHttpAdapter(weChatFerryBotHttpAdapter);
  }

  @Override
  public String agreement() {
    return WeChatFerryBot.NAME;
  }

  @Override
  public void close() {

  }

  @Override
  public Adapter receiveAdapter() {
    return receiveAdapter;
  }

  @Override
  public Adapter sendAdapter() {
    return sendAdapter;
  }

  @Override
  public Internal internal() {
    return new WeChatFerryBotInternal(this);
  }
}
